<extend name="Public:base"/>

<!--侧边导航-->
<block name="aside">
    <include file="Public:aside"/>
</block>

<block name="main">

    <form id="myform" class="form-horizontal" action="{:U('Kefu/add')}" method="post">

        <div class="form-group">
            <label class="col-sm-2 control-label">客服名称</label>
            <div class="col-xs-4">
                <input type="text" class="form-control" name="name"/>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label">客服类型</label>
            <div class="col-xs-4">
                <select class="form-control" name="type">
                    <option value="1">QQ</option>
                    <option value="2">旺旺</option>
                    <option value="3">Skype</option>
                    <option value="4">电话</option>
                </select>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label">ID或代码</label>
            <div class="col-xs-4">
                <textarea  id="code" name="code" rows="3" cols="40" class="form-control">{$vo['code']}</textarea>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label">状态</label>
            <div class="col-xs-4">
                <input type="radio" name="status" value="1" checked="checked"/>启用
                <input type="radio" name="status" value="0" />禁用
            </div>
        </div>

        <div class="form-actions">
            <input type="submit" value="{:L('dosubmit')}" class="btn btn-sm btn-primary" >
            <input type="reset" value="{:L('cancel')}" class="btn btn-sm btn-primary">
        </div>
    </form>

</block>

<block name="script">
    <script type="text/javascript">
        $(document).ready(function() {
            $('#myform').ajaxForm({
                success:  complete,  // post-submit callback
                dataType: 'json'
            });
        });

        function complete(data){
            if (data.status == 1) {

                layer.confirm(data.info, {
                    icon:1,
                    btn: ['继续添加','返回列表'] //按钮
                }, function(){
                    window.location.href = "{:U('Kefu/add')}";
                    return false;
                }, function(){
                    window.location.href = "{$Think.cookie.__forward__}";
                    return true;
                });

            } else {
                layer.msg(data.info, {icon: 2});
            }

        }
    </script>
</block>